package gui.threads;

import java.sql.SQLException;

import gui.Main;
import gui.Utils;

import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;

import LogicSide.ManageSongPlaylist;

public class createPlayListThread extends Thread {

	private String playlistName;
	private Shell shell;
	private List playlistsList;
	public createPlayListThread(String playlistName, Shell shell, List playlistsList) {
		super();
		this.playlistName = playlistName;
		this.shell = shell;
		this.playlistsList = playlistsList;
	}
	
	@Override
	public void run() {
			ManageSongPlaylist.createPlaylist(playlistName, Main.session);
			Main.display.asyncExec(new Runnable() {
				@Override
				public void run() {
					playlistsList.add(playlistName);
					Utils.popUpBox("Success", "Created new playlist!", shell);
				}
			});
	}
}
